//获取按钮元素对象
let upBtn = document.getElementById("up");         //上一张按钮
let downBtn = document.getElementById("down");     //下一张按钮
let img = document.getElementById("pic");           //图片
let dbBtn = document.getElementById("dbclk");       //双击按钮
let textbox1 = document.getElementById("textbox");  //编辑框

//设置事件
upBtn.onclick = up;
downBtn.onclick = down;

//上一张
function up() {
    img.setAttribute("src", "img/01.png");
}


//下一张
function down() {
    img.setAttribute("src", "img/02.png");
}


//表单提交触发事件
document.onsubmit = function () {
    alert("内容:" + document.getElementById("input").value + "\n提交成功!")
};

//双击按钮触发事件
dbBtn.ondblclick = function () {
    alert("让你双击就双击吗?崽种!");
}

//编辑框获得焦点事件
textbox1.onfocus = function () {
    textbox1.value = "我被选中啦";
}

//编辑框失去焦点事件
textbox1.onblur = function () {
    textbox1.value = "点我啊";
}

//编辑框1被修改
let textbox2 = document.getElementById("textbox1");
textbox2.onchange = function () {
    alert("修改后:" + textbox2.value);
}



